#include"process.h"

void process_v2(double current, double total);

typedef void(*Fflush)(double,double);

#define total 1024.0 // 资源的大小
#define speed 1.0 // 网速

void download(Fflush process)
{
    double current = 0;
    while(current <= total)
    {
        process(current, total);
        
        usleep(1000); // 模拟下载 
        current += speed; // 更新current，代表已经下载的资源
    }
    printf("资源已下载完毕，共%.2lf\n",current);
}


int main()
{
    //test();
    //process_v1();
    
    download(process_v2);
    printf("\n");
    return 0;
}
